package com.nx.qwr;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

/**
 * @Author: Qingwr
 * @Date: 2022/8/16 15:43
 * @Description 按条件对对电话号码进行分区
 */
public class PFPationer extends Partitioner<Text, NullWritable> {


    @Override
    public int getPartition(Text text, NullWritable e, int i) {
        String s = text.toString();
        if(s.startsWith("135")){
            return 0;
        }
        if(s.startsWith("136")){
            return 1;
        }
        if(s.startsWith("137")){
            return 2;
        }
        return 3;
    }
}
